//
//  EditDataController.m
//  EducationAdminClient
//
//  Created by KWSD on 15/12/8.
//  Copyright © 2015年 周佳兴. All rights reserved.
//

#import "EditDataController.h"
//#import "listDetailCell.h"
#import "CustomTextField.h"
#import "EditCell.h"
#import "EditOneController.h"
#import "SelectSchoolController.h"
#import "KeyNameClass.h"
#import "OneSelectView.h"
#import "SelectManyView.h"
#import "Masonry.h"
#import "PickerTimeView.h"
#import "PicAddListsViewController.h"
#import "EditModel.h"
#import "KeyValuesClass.h"

@interface EditDataController (){
//    NSMutableArray      *yeaArr;
//    NSArray             *monArr;
//    NSMutableArray      *daArr;
//    NSString            *yeaStr;
//    NSString            *montStr;
//    NSString            *daStr;
    UIView              *withShowPicView;
    BOOL                editSucceed;
    KeyValuesClass      *keyValueClass;
    
}
@property(nonatomic,retain)UIAlertView *alert;
@property(nonatomic,retain)OneSelectView *oneSelectView;
@property(nonatomic,retain)SelectManyView *SelectManyView;
@property(nonatomic,assign)NSInteger indexNum;
@property(nonatomic,retain)NSMutableArray *itemDic;
@property(nonatomic,retain)NSDictionary *oneDic;
@property(nonatomic,retain)NSMutableDictionary *towDic;
@property(nonatomic,retain)NSMutableDictionary *relationDic;
@property(nonatomic,retain)NSMutableDictionary *allFirstDic;
@property(nonatomic,retain)NSMutableArray *manyManyArr;//内置选项的字段
@property(nonatomic,retain)NSMutableArray *schoolsArr;
@property(nonatomic,copy)NSString *isSeleItem;
@property(nonatomic,retain)UIImageView *backImg;
//@property(nonatomic,retain)NSMutableArray *insertArr;
@property(nonatomic,assign)NSInteger roleNum;
@property(nonatomic,assign)NSInteger lastItemNum;
@property(nonatomic,strong)UIAlertView *alertSure1;
@property(nonatomic,assign)UIButton *editBtn;
//@property(nonatomic,strong)NSMutableArray *firstArr;

@property(nonatomic,retain)UIImageView *timeBackImg;
@property(nonatomic,retain)NSMutableDictionary *textDic;  // 准备删除
@property(nonatomic,assign)int numaa;
@property(nonatomic,retain)NSMutableArray *insertAddArr;
@property(nonatomic,retain)PickerTimeView *pickerTime;
@property(nonatomic,retain)NSMutableArray *hiddenArr;
@property(nonatomic,retain)NSMutableArray        *conditionShow;   // 前提条件集成


@end

@implementation EditDataController


static NSInteger            _rowsNum;
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.tString = @"t0";
    
    _tNum = 0;
    
    _numaa = 0;
    _fieldArr = [[NSMutableArray alloc]init];
    
    _fieldArrText = [[NSMutableArray alloc]init];

    
    _hiddenArr = [[NSMutableArray alloc]init];
    
    _sendMutDic = [[NSMutableDictionary alloc]init];

    _manyManyArr =[[NSMutableArray alloc]init];

    _isSeleItem = @"no";
    _relationDic = [[NSMutableDictionary alloc]init];
//    yeaArr = [[NSMutableArray alloc]init];
    _itemDic = [[NSMutableArray alloc]init];
    _oneDic =[[NSDictionary alloc]init];
    _towDic =[[NSMutableDictionary alloc]init];
    _allFirstDic =[[NSMutableDictionary alloc]init];
    _schoolsArr = [[NSMutableArray alloc]init];
    _backImg = [[UIImageView alloc]init];
//    _insertArr = [[NSMutableArray alloc]init];
//    _firstArr =[[NSMutableArray alloc]init];
    _textDic = [[NSMutableDictionary alloc]init];
    _backImg.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
    _backImg.backgroundColor =[UIColor colorWithRed:30/255.0 green:32/255.0 blue:40 /255.0 alpha:0.5];
    [self.view bringSubviewToFront:_backImg];
    _backImg.userInteractionEnabled = YES;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClick)];
    [_backImg addGestureRecognizer:tap];
    
    _backImg.hidden = NO;
    [self.view addSubview:_backImg];
    
    
    [self createLeftNavBar];
    
    if(!self.edit == YES){
        [self createRightNavBar];

    }

    [self dataRequest];
    
    
    self.tbView = [[UITableView alloc]init];
    self.tbView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [self.view addSubview:self.tbView];
    //    self.tbView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
    [self.tbView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.top.equalTo(self.view.mas_top);
        make.bottom.equalTo(self.view.mas_bottom);
    }];
    self.tbView.dataSource =self;
    self.tbView.delegate = self;
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(receiveSeleData:) name:@"schools" object:nil];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(receiveText:) name:@"text" object:nil];
    [self createUI];
    
//    [self currDate];
    
    
    keyValueClass = [[KeyValuesClass alloc]init];
    keyValueClass.sendMutDic = self.sendMutDic;
    keyValueClass.manyManyArr = _manyManyArr;
    keyValueClass.hiddenArr = _hiddenArr;
    keyValueClass.EditDic = _EditDic;

}



#pragma mark - tap to hidden one select view
-(void)tapClick{
    
    _backImg.hidden = YES;
    _oneSelectView.hidden=YES;
    _oneSelectView.frame = CGRectMake(50, 1000, 200, 200);
    _oneSelectView.seleTitle = @"";
    
    _SelectManyView.hidden=YES;
    _SelectManyView.frame = CGRectMake(50, 1000, 200, 200);
    _SelectManyView.seleTitle = @"";
    //    _oneSelectView=nil;
    //    _oneSelectView = [[OneSelectView alloc]initWithFrame:CGRectMake(50, 1000, [UIScreen mainScreen].bounds.size.width-100, 200)];
    [self.view addSubview:_oneSelectView];
    [self.view addSubview:_SelectManyView];
    
}


-(void)createUI{
    
    
    
    withShowPicView = [[UIView alloc]init];
    withShowPicView.hidden = YES;
    [self.view addSubview:withShowPicView];
    withShowPicView.backgroundColor = [UIColor whiteColor];
    [withShowPicView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view.mas_bottom).offset(-49);
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.height.equalTo(@(342/2));
    }];
    
    
    
    UIImageView *whichView = [[UIImageView alloc]init];
    whichView.image = [UIImage imageNamed:@"whitchB"];
    whichView.userInteractionEnabled = YES;
    [withShowPicView addSubview:whichView];
    [whichView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(withShowPicView.mas_top);
        make.left.equalTo(withShowPicView.mas_left);
        make.right.equalTo(withShowPicView.mas_right);
        make.height.equalTo(@(100/2));
    }];
    UIButton *cancelButton = [[UIButton alloc]init];
    //    cancelButton.backgroundColor = [UIColor blackColor];
    [whichView addSubview:cancelButton];
    [cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(whichView.mas_centerY);
        make.left.equalTo(whichView.mas_left).offset(32/2);
        //        make.right.equalTo(withShowPicView.mas_right);
        make.height.equalTo(@(48/2));
    }];
    [cancelButton setImage:[UIImage imageNamed:@"cancelNbUTTON"] forState:UIControlStateNormal];
    [cancelButton setImage:[UIImage imageNamed:@"cancelButton"] forState:UIControlStateSelected];
    UILabel *centerLabel = [[UILabel alloc]init];
    [whichView addSubview:centerLabel];
    [centerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(cancelButton.mas_centerY);
        make.centerX.equalTo(whichView.mas_centerX);
        //        make.right.equalTo(withShowPicView.mas_right);
        //        make.height.equalTo(@(48/2));
    }];
    
    
    centerLabel.font = [UIFont systemFontOfSize:32/2];
    centerLabel.text = @"选择时间";
    centerLabel.textColor = [UIColor colorWithRed:0x74/255.0 green:0x75/255.0 blue:0x79/255.0 alpha:1];
    UIButton *okButton = [[UIButton alloc]init];
    [whichView addSubview:okButton];
    [okButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(cancelButton.mas_centerY);
        make.right.equalTo(whichView.mas_right).offset(-32/2);
        //        make.right.equalTo(withShowPicView.mas_right);
        make.height.equalTo(@(48/2));
    }];
    [cancelButton addTarget:self action:@selector(cancelClick) forControlEvents:UIControlEventTouchUpInside];
    [okButton addTarget:self action:@selector(okClick) forControlEvents:UIControlEventTouchUpInside];
    [okButton setImage:[UIImage imageNamed:@"okNButton"] forState:UIControlStateNormal];
    [okButton setImage:[UIImage imageNamed:@"okButotn"] forState:UIControlStateSelected];
    whichView.backgroundColor = [UIColor grayColor];
    //    cancelButton.backgroundColor = [UIColor blackColor];
    //    okButton.backgroundColor = [UIColor orangeColor];
    
//    _pickerView = [[UIPickerView alloc]init];
//    _pickerView.backgroundColor = [UIColor whiteColor];
//    _pickerView.delegate = self;
//    _pickerView.dataSource = self;
//    _pickerView.showsSelectionIndicator = YES;
//    
//    _pickerView.hidden = YES;
//    [withShowPicView addSubview:_pickerView];
//    [_pickerView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerX.equalTo(withShowPicView.mas_centerX);
//        make.bottom.equalTo(withShowPicView.mas_bottom);
//        make.top.equalTo(whichView.mas_bottom).offset(50);
//        make.width.equalTo(withShowPicView.mas_width);
//    }];
    
    //    sexView = [[SexView alloc]initWithBlock:^(NSString *str) {
    //        NSLog(@"%@", str);
    //        focusTextField.text = str;
    //    }];
    //    [self.view addSubview:sexView];
    
    
    _oneSelectView = [[OneSelectView alloc]initWithFrame:CGRectMake(50, 1000, [UIScreen mainScreen].bounds.size.width-100, 200)];
    [self.view addSubview:_oneSelectView];
    ;
    _oneSelectView.delegateView = self;
    
    
    _SelectManyView = [[SelectManyView alloc]initWithFrame:CGRectMake(50, 1000, [UIScreen mainScreen].bounds.size.width-100, 200)];
    [self.view addSubview:_SelectManyView];
    ;
    _SelectManyView.delegateView = self;
    
    //    [_oneSelectView.leftBtn addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    //    [_oneSelectView.rightBtn addTarget:self action:@selector(rightBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    
    _timeBackImg = [[UIImageView alloc]init];
    [self.view addSubview:_timeBackImg];
    [_timeBackImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.top.equalTo(self.view.mas_top);
        make.bottom.equalTo(withShowPicView.mas_top);
    }];
    _timeBackImg.alpha = 0.5;
    _timeBackImg.userInteractionEnabled = YES;
    _timeBackImg.backgroundColor = [UIColor blackColor];
    _timeBackImg.hidden = withShowPicView.hidden;
    
    
    self.pickerTime = [[PickerTimeView alloc]init];
    
    self.pickerTime.delegagte = self;
    [self.view addSubview:self.pickerTime];
    [self.pickerTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left);
        make.top.equalTo(self.view.mas_top);
        make.right.equalTo(self.view.mas_right);
        make.bottom.equalTo(self.view.mas_bottom);
    }];
    
        self.pickerTime.hidden = YES;

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(cancelClick)];
    [_timeBackImg addGestureRecognizer:tap];
}


#pragma mark - 时间选择器选择收入的收到的时间字符串回调方法
-(void)picTimeReceive:(NSString *)dateStr{

    EditModel *model = _fieldArrText[_rowsNum];
    
    CustomTextField *titleText = (CustomTextField *)[self.view viewWithTag:1000+_rowsNum];
    titleText.hidden = NO;
    NSString *str =[NSString stringWithFormat:@"%@", dateStr];
    titleText.text = str;
    
    model.true_defaultShowValName = str;
    
    NSString *baseString = [NSString stringWithFormat:@"%@", model.montageName]; //[NSString stringWithFormat:@"_au_%@_%@_%@",tableId,pageId,fieldId];
    [_sendMutDic setObject:str forKey:baseString];
    NSLog(@"%@",_sendMutDic);

    self.pickerTime.hidden = YES;
}
#pragma mark - show pickerView and the cancel btn and the sure btn
-(void)cancelClick{
    withShowPicView.hidden = YES;
    _timeBackImg.hidden = withShowPicView.hidden;
}

//-(void)okClick{
//    
//    /**
//     yeaStr, montStr, daStr 即为年月日
//     */
//    if (yeaStr&&montStr&&daStr) {
//        _pickerView.hidden = YES;
//        withShowPicView.hidden = YES;
//        _timeBackImg.hidden = withShowPicView.hidden;
//        
//        //        focusTextField.text = [NSString stringWithFormat:@"%@-%@-%@", yeaStr, montStr, daStr];
//        //            yeaStr = nil;
//        //            montStr = nil;
//        //            daStr = nil;
//        CustomTextField *textField = (CustomTextField *)[self.view viewWithTag:1000+_rowsNum];
//        textField.hidden = NO;
//        textField.text = [NSString stringWithFormat:@"%@-%@-%@", yeaStr, montStr, daStr];
//        CustomTextField *titleText = (CustomTextField *)[self.view viewWithTag:1000+_rowsNum];
//        titleText.hidden = NO;
//        NSString *str =[NSString stringWithFormat:@"%@-%@-%@", yeaStr, montStr, daStr];
//        titleText.text = str;
//        [_textDic setObject:str forKey:[NSString stringWithFormat:@"%ld",(long)_rowsNum]];
//        NSDictionary *dic= [_fieldArr objectAtIndex:_rowsNum];
//        NSString *fieldRole= [dic objectForKey:@"fieldRole"];
//        NSString *fieldId= [dic objectForKey:@"fieldId"];
//        NSString *pageId= [_EditDic objectForKey:@"startTurnPage"];
////        NSString *tableId= [_dataDic objectForKey:@"tableId"];
//        NSString *tableId= [_EditDic objectForKey:@"tableId"];
//
//        NSString *baseString = [NSString stringWithFormat:@"_au_%@_%@_%@",tableId,pageId,fieldId];
//        [_sendMutDic setObject:str forKey:[KeyNameClass getKeyName:fieldRole andBaseString:baseString andTUseString:self.tString]];
//        NSLog(@"%@",_sendMutDic);
//    }
//}

#pragma mark - 正常字段返回  调的的的的的 方法
-(void)receiveText:(NSString *)notify{
    CustomTextField *titleText = (CustomTextField *)[self.view viewWithTag:1000+_rowsNum];
    titleText.hidden = NO;
    
    
    
    
    NSString *str =notify;
    titleText.text = str;
    EditModel *model = _fieldArrText[_rowsNum];
    model.true_defaultShowValName = str;
    
    [_sendMutDic setObject:str forKey:model.montageName];
    
    NSLog(@"%@",_sendMutDic);
}



#pragma mark - 弹层获取返回的值
-(void)receiveSeleData:(NSArray *)arr{
    CustomTextField *titleText = (CustomTextField *)[self.view viewWithTag:1000+_rowsNum];
    titleText.hidden = NO;
    
    NSString *titleStr;
    NSString *iDString;
    if(arr.count>1){
        
        titleStr = [arr[0] componentsJoinedByString:@","];
        iDString = [arr[1] componentsJoinedByString:@","];
    }else{
        titleStr = @"";
        iDString = @"";
    }
    titleText.text = titleStr;
    
    EditModel *model = _fieldArrText[_rowsNum];
    model.true_defaultShowValName = titleStr;
    model.true_defaultShowValId = iDString;
    //*** 键拼接 方法可能数据请求中也需要用 所以做了个简单的封装
    
    [keyValueClass whileFieldRowTypeIsspeciall:model andTnum:_tNum andTstring:self.tString andSendMutDic:_sendMutDic andManyMan:_manyManyArr andEditDetailDic:_EditDic andReturnBlock:^(NSMutableDictionary *send, NSMutableArray *manyman, NSDictionary *dicDEdit, EditModel *model211){
        _sendMutDic = send;
        _manyManyArr = manyman;
        _EditDic = dicDEdit;
//        [_fieldArrText replaceObjectAtIndex:_rowsNum withObject:model211];
    }];
    
//    [self whileFieldRowTypeIsspeciall:model];
    
        [self.tbView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:titleText.indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
    
}

-(void)createRightNavBar{
    UIButton *rightNavBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.editBtn = rightNavBtn;
    
    rightNavBtn.frame = CGRectMake(0, 0, 50, 23);
    [rightNavBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    [rightNavBtn addTarget:self action:@selector(rightClick:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:rightNavBtn];
    //    self.navigationItem.leftBarButtonItem = item;
    [rightNavBtn setTitle:@"提交" forState:UIControlStateNormal];
    self.navigationItem.rightBarButtonItem = item;
    
}


#pragma mark - oneSelectBtn founction
-(void)leftBtnClick:(UIButton *)btn{
    
    _oneSelectView.hidden = YES;
    _oneSelectView.frame = CGRectMake(50, 1000, [UIScreen mainScreen].bounds.size.width-100, 200);
    
    _SelectManyView.hidden = YES;
    _SelectManyView.frame = CGRectMake(50, 1000, [UIScreen mainScreen].bounds.size.width-100, 200);
    _backImg.hidden = YES;
}


#pragma mark - oneSele
-(void)rightBtnClick:(UIButton *)btn{
    [self setNormalDataDic];

    _oneSelectView.frame = CGRectMake(50, 1000, 200, 200);
    _oneSelectView.seleTitle = @"";
    
    _SelectManyView.hidden=YES;
    _SelectManyView.frame = CGRectMake(50, 1000, 200, 200);
    _SelectManyView.seleTitle = @"";
    _numaa++;
}

#pragma mark - 正常字段设置数据字典
-(void)setNormalDataDic{
//    if(_oneSelectView.seleTitle !=nil){
//        
//        //*** 找到当前需要显示的textField
//        CustomTextField *textField = (CustomTextField *)[self.view viewWithTag:1000+_indexNum];
//        textField.hidden = NO;
//        textField.text = _oneSelectView.seleTitle;
//        _oneSelectView.frame = CGRectMake(50, 1000, 200, 200);
////*** 之前遗留的代码，可能会影响某种作用所以没删
//        [self.view addSubview:_oneSelectView];
//        
//        //*** 找到当前的model数据源
//        EditModel *model = _fieldArrText[textField.indexPath.row];
//        model.true_defaultShowValName = _oneSelectView.seleTitleNum;
//
//#warning ttableId may not this
//        [_sendMutDic setObject:_oneSelectView.seleTitleNum forKey:model.montageName];
//
//        _oneSelectView.seleTitle = @"";
//        
//        NSLog(@"%@",_sendMutDic);
//        
//        
//        //***  如果有前提条件清空之前的前提条件
//        for (EditModel *model in _conditionShow) {
////            BOOL is = [self textQianTiTiaoJian:model];
//            
//            
//            BOOL is = [keyValueClass textQianTiTiaoJian:model andTstring:_tString];
//
//            if (!is) {
////                [self removeAlready:model];
//                [keyValueClass removeAlready:model andTstring:_tString andManyManyArr:_manyManyArr andTnumBer:_tNum andSendMutDic:_sendMutDic andEditDic:_EditDic andReturnBlock:^(NSMutableDictionary *send, NSMutableArray *manyman, EditModel *modelReturn){
//                    _sendMutDic = send;
//                    _manyManyArr = manyman;
////                    _forRetunModel = modelReturn;
//                }];
//                
//                model.true_defaultShowValName = @"";
//                model.true_defaultShowValId = @"";
//            }
//        }
//        [self.tbView reloadData];
//
//
//    }
//    
//    _oneSelectView.hidden=YES;
//    _backImg.hidden = YES;
    
}


#pragma many ele
-(void)rightBtnClick1:(UIButton *)btn{
    
    CustomTextField *textField = (CustomTextField *)[self.view viewWithTag:1000+_indexNum];
    textField.hidden = NO;
    textField.text = _SelectManyView.seleTitle;

    _backImg.hidden = YES;
    _SelectManyView.hidden=YES;
    _SelectManyView.frame = CGRectMake(50, 1000, 200, 200);
    _SelectManyView.seleTitle = @"";
    
    _SelectManyView.hidden=YES;
    _SelectManyView.frame = CGRectMake(50, 1000, 200, 200);
    _SelectManyView.seleTitle = @"";

    
    EditModel *model = _fieldArrText[textField.indexPath.row];
    
    model.true_defaultShowValName = _SelectManyView.seleTitleNum;


    if(_SelectManyView.seleTitleNum!=nil){
        
        [_sendMutDic setObject:_SelectManyView.seleTitleNum forKey:model.montageName];


        
    }
    NSLog(@"%@",_sendMutDic);
    _numaa++;
}

#pragma mark commit the change button
-(void)rightClick:(UIButton *)btn{
    
    NSLog(@"%@", _sendMutDic);
    btn.enabled = NO;
    _alertSure1 =[[UIAlertView alloc]initWithTitle:@"提示" message:@"是否确认修改" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [_alertSure1 show];
    
    
    
}




#pragma -mark newAddClickArray end



-(void)doTime{
    [_alert dismissWithClickedButtonIndex:0 animated:NO];
}


-(void)dataRequest{
    NSMutableDictionary *parmas = [[NSMutableDictionary alloc]init];
    [parmas setObject:userName() forKey:@"loginName"];
    [parmas setObject:passWord() forKey:@"password"];
    [parmas setObject:[_fieldDic objectForKey:@"startTurnPage"] forKey:@"pageId"];
    [parmas setObject:self.tableId forKey:@"tableId"];
    
    [parmas setObject:[_fieldDic valueForKey:@"tableId"] forKey:@"mainTableId"];
    [parmas setObject:self.pageId forKey:@"mainPageId"];

    [parmas setObject:[NSString stringWithFormat:@"%@", [_detailDic valueForKey:[NSString stringWithFormat:@"T_%@_0", self.tableId]]] forKey:@"mainId"];
    
    NSString *strTnum = [NSString stringWithFormat:@"%i", _tNum];
    [parmas setObject:strTnum forKey:@"tNumber"];

    [parmas setObject:@"2222211" forKey:@"alterTime"];

    NSString *requestStr;// =getUrl(EDIT_URL);
    
    requestStr = [NSString stringWithFormat:@"%@%@", self.programaUrl, UPDATEMF_URL];
    [NetRequest requestUrl:requestStr andParamas:parmas andReturnBlock:^(NSData *data, NSError *error) {
        if(data!=nil&&!error){
            NSDictionary *obj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
            
            // 数据处理，当没问题的情况下
            [self dataUse:obj];
            _itemDic = [obj valueForKey:@"dataInfo"];
//            [self.tbView reloadData];
        }else{
            NSString *str = [NSString stringWithFormat:@"%@", error.localizedDescription];
            [self showLabelWithText:str];

        }
        
    }];
    
    
}


#pragma mark - 数据处理
-(void)dataUse:(id)obj{
    
    //***jsonModel 数据处理 , 如果键值对有所改变 ， 那么就将 model 内的 内容进行更改，注意 使用时的问题 ， cellForrowInThePath
    _conditionShow = [[NSMutableArray alloc]init];

    if([obj objectForKey:@"pageSet"]){
        NSArray *dataArr = [[obj objectForKey:@"pageSet"]valueForKey:@"fieldSet"];
        for (NSDictionary *dic in dataArr) {
            EditModel *model = [[EditModel alloc]init];
            model = [model initWithDictionary:dic error:nil];
            [_fieldArrText addObject:model];
            if (model.jsWhereStr) { // 查看是否有启用禁用条件
                [_conditionShow addObject:model];
            }
            
            NSString *fieldRole =[NSString stringWithFormat:@"%@", model.fieldRole];
            NSInteger num =[fieldRole integerValue];
            // 拼接上传值
            if(num == 20 || num == 21 || num == 22){// 弹层 下拉树 内部对象
                
//                [self whileFieldRowTypeIsspeciall:model];
                
                [keyValueClass whileFieldRowTypeIsspeciall:model andTnum:_tNum andTstring:_tString andSendMutDic:_sendMutDic andManyMan:_manyManyArr andEditDetailDic:_EditDic andReturnBlock:^(NSMutableDictionary *send, NSMutableArray *manyman, NSDictionary *dicDEdit, EditModel *model){
                    _sendMutDic = send;
                    _manyManyArr = manyman;
                    _EditDic = dicDEdit;
                }];
            }else if(num == 14||num==28||num==26|| num == 15){ // 时间格式的 使用
                //NSDateFormatter *formate = [[NSDateFormatter alloc]init];
                
                if(model.true_defaultShowValName){
                    model.true_defaultShowValName = [KeyValuesClass dateGlinToFormate:model.true_defaultShowValName andFromate:model.dateType]; // 由于时间格式返回的都是  格林尼治 所以 ····
                [_sendMutDic setObject:model.true_defaultShowValName forKey:model.montageName];
                }else{
                    [_sendMutDic setObject:@"" forKey:model.montageName];

                }
                
            }else{
                                if(model.true_defaultShowValName){
                                    [_sendMutDic setObject:model.true_defaultShowValName forKey:model.montageName];
                                }else{
                                    [_sendMutDic setObject:@"" forKey:model.montageName];
                                }

            }

        }
        NSArray *arrHiddenText = [[obj objectForKey:@"pageSet"]valueForKey:@"hideFieldSet"];
        
        for (NSDictionary *dic in arrHiddenText) {
            EditModel *model = [[EditModel alloc]init];
            model = [model initWithDictionary:dic error:nil];
            [_hiddenArr addObject:model];
        }

        [self.tbView reloadData];
    }
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _fieldArrText.count;
    
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    EditModel *model = _fieldArrText[indexPath.row];
    
//    NSArray *allkey = [_textDic allKeys];
    

    //NSInteger roleNum = [model.fieldRole integerValue];
    NSString *fieldRole =[NSString stringWithFormat:@"%@", model.fieldRole];

#pragma - mark   *处理cell不同样式
    NSInteger num =[fieldRole integerValue];

    static NSString *listCell = @"listCell";
    EditCell *cell = [tableView dequeueReusableCellWithIdentifier:listCell];
    if (cell == nil) {
        cell = [[EditCell alloc]initWithReuseIdentifier:listCell];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;

    }
    
    [cell setEditIs:YES];
    //*** 左侧显示Label
    cell.title.text =[NSString stringWithFormat:@"%@:",model.fieldCnName];
    cell.titleText.indexPath = indexPath;

    //*** 可点 不可点          的跳转页面
    cell.titleText.tag = 1000+indexPath.row;
    if (num ==16||num == 14||num==28||num==26||num == 15) { // 15 时间 14 日期15 数据字典
        cell.titleText.enabled = NO;
    }else{
        cell.titleText.enabled = YES;
    }


    
    //*** right textFileld text
    NSString *cellTitleTextStringText;
    if(model.true_defaultShowValName&&num!=16&&num!=14&&num!=15&&num!=16&&num!=26&&num!=28){
    
    cellTitleTextStringText= [NSString stringWithFormat:@"%@", model.true_defaultShowValName];
    }else if(num == 16){
        NSArray *dataDicArr = [NSArray arrayWithArray:model.dicList]; // 取出数据字典中的值
        NSString *inter = [NSString stringWithFormat:@"%@", model.true_defaultShowValName]; // 默认值
        
                for (NSDictionary *dicDicList in dataDicArr) {
                    {
                        NSString *inter1 = [NSString stringWithFormat:@"%@", [dicDicList valueForKey:@"DIC_ID"]]; // 数据字典内值
                        if([inter isEqualToString:inter1]){
                        cellTitleTextStringText = [NSString stringWithFormat:@"%@", [dicDicList valueForKey:@"DIC_NAME"]];
                    }
                    }
                }

    }else if(model.true_defaultShowValName&&(num==14||num==15||num==16||num==26||num==28)){
        
        cellTitleTextStringText = model.true_defaultShowValName;  // 由于时间格式返回的都是  格林尼治 所以 ····
    }else{
            cellTitleTextStringText = @"";
    }
    
    //*** 所有页面均为跳转编辑所以全设为不可编辑
    [cell setEditIs:NO];
    cell.titleText.hidden = NO;

    
    cell.titleText.text = cellTitleTextStringText;
    
    if(self.edit == YES){
        cell.titleText.enabled = NO;
    }
    
    
    //*** 是否可更改 ， 也就是说回显
    
    if([[NSString stringWithFormat:@"%@", model.ifUpdate] isEqualToString:@"0"]||model.ifUpdate==nil){
        cell.backgroundColor = [UIColor colorWithRed:241/255.0 green:241/255.0 blue:241/255.0 alpha:1];
        cell.titleText.enabled = NO;
    }else{
        cell.backgroundColor = [UIColor whiteColor];
    }


    return cell;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    //*** for height str
    NSString *setHeighStr = @"";
    
    
    //NSArray *allkey = [_textDic allKeys];
    
//    NSDictionary *dic =[_fieldArr objectAtIndex:indexPath.row];
    
    EditModel *model = _fieldArrText[indexPath.row];
    //setHeighStr = [NSString stringWithFormat:@"%@", model.true_defaultShowValName];
    
#pragma - mark   *处理cell不同样式
//    //*** right textFileld text
    NSString *cellTitleTextStringText;
    cellTitleTextStringText = [NSString stringWithFormat:@"%@", model.true_defaultShowValName];
    
    CGFloat contentWidth = self.tbView.frame.size.width;

    CGSize size =  [cellTitleTextStringText boundingRectWithSize:CGSizeMake(contentWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size;
    if(size.height>60){
        return size.height+size.height+50;
    }
    return size.height+60;
}
//-(void)createPickerView{
//    [self resignFirstResponder];
//    withShowPicView.hidden = NO;
//    _timeBackImg.hidden = withShowPicView.hidden;
//    
//    _pickerView.hidden = NO;
//}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
//    if(self.edit == YES){
//        return;
//    }
//
//    NSLog(@"%@",_manyManyArr);
//    
//    EditModel *model = _fieldArrText[indexPath.row];
//    
//    //*** 前提条件
//    if(model.jsWhereStr){
//        
////        BOOL is = [self textQianTiTiaoJian:model];
//        
//        BOOL is = [keyValueClass textQianTiTiaoJian:model andTstring:_tString];
//
//        if (!is) {
//            return;
//        }
//    }
//
//    if([[NSString stringWithFormat:@"%@", model.ifUpdate] isEqualToString:@"0"]||!model.ifUpdate){
//        return;
//    }
//    NSString *strRoleNum = [NSString stringWithFormat:@"%@", model.fieldRole];
//    NSString *strAddStyle = [NSString stringWithFormat:@"%@", model.addStyle];
//    NSInteger roleNum = [strRoleNum integerValue];
//    NSInteger addStyle = [strAddStyle integerValue];
//    EditOneController *sv = [[EditOneController alloc]init];
//    _rowsNum = indexPath.row;
//    if(roleNum==16){//单选  数据字典
//        [self.view bringSubviewToFront:_backImg];
//        _backImg.hidden = NO;
//        [self.view bringSubviewToFront:_oneSelectView];
//        [UIView animateWithDuration:0.5 animations:^{
//            //            _oneSelectView = [[OneSelectView alloc]initWithFrame:CGRectMake(50, 100, [UIScreen mainScreen].bounds.size.width-100, 500)];
//            _oneSelectView.frame = CGRectMake(50, 100, [UIScreen mainScreen].bounds.size.width-100, 200);
//        }];
//        _indexNum = indexPath.row;
//        
//        
//        //*** 数据处理过程
//        NSString *strDicChildShow = [NSString stringWithFormat:@"%@", model.dicChildShow];
//
//        NSArray *chilArr = [strDicChildShow componentsSeparatedByString:@","];
//        
//        NSArray *dicLArr = model.dicList;
//
//        NSMutableArray *dicArr = [[NSMutableArray alloc]init];// = [dic valueForKey:@"dicList"];
//        if(chilArr.count>0&&strDicChildShow.length>0){
//
//            for (NSDictionary *dicElement in dicLArr) {
//                NSString *strEleDic = [NSString stringWithFormat:@"%@", [dicElement valueForKey:@"DIC_ID"]];
//                
//                for (id obj in chilArr) {
//                    NSString *objStr = [NSString stringWithFormat:@"%@", obj];
//                    if ([strEleDic isEqualToString:objStr]) {
//                        [dicArr addObject:dicElement];
//                    }
//                }
//            }
//        }else{
//            [dicArr addObjectsFromArray:dicLArr];
//        }
//
////        _pickerView.hidden = YES;
//        _pickerTime.hidden = YES;
//        _oneSelectView.dataArr = dicArr;
//        _oneSelectView.hidden = NO;
//    }
//    else if(roleNum == 20||roleNum == 21 || roleNum == 22){ //*** 下拉树  + 弹层
//        
//        NSString *fieldRole =[NSString stringWithFormat:@"%@", model.fieldRole];
//
//        NSInteger num =[fieldRole integerValue];
//        if(num==21||num == 20 || num == 22){
//            
//            
//                //*** 添加类型的页面暂时先不改
//                if (addStyle == 3) { // 点击加号添加
//                    if (model.showFieldArr) { // pageId [dic valueForKey:@"showFieldArr"]
//                        PicAddListsViewController *picAddVC = [[PicAddListsViewController alloc]init];
////                        picAddVC.tableId = [NSString stringWithFormat:@"%@", [dic valueForKey:@"tableId"]];
//                        picAddVC.tableId = [NSString stringWithFormat:@"%@", model.tableId];
//
////                        picAddVC.pageId = [NSString stringWithFormat:@"%@", [dic valueForKey:@"showFieldArr"]];
//                        picAddVC.pageId = [NSString stringWithFormat:@"%@", model.showFieldArr];
//
//                        picAddVC.fromDataArr = self.fieldArr;
//                        picAddVC.fromMangManArr = self.manyManyArr;
//                        picAddVC.fromSendMutDic = self.sendMutDic;
//                        picAddVC.delegateView = self;
//                        picAddVC.buttonDic = _ADDBTN;
//                        picAddVC.tNum = _tNum;
//                        
//                        _rowNum = indexPath.row;
//                        
//                        NSLog(@"%@", picAddVC.fromDataArr);
//                        [self.navigationController pushViewController:picAddVC animated:YES];
//                        
//                    }
//                    
//                    return;
//                }
//
//
//                        NSMutableDictionary *selectSchoolKeyValueDic = [[NSMutableDictionary alloc]init];
//
//            
//            
//            NSString *needFilterStr = [NSString stringWithFormat:@"%@", model.needFilter];
//
//            if ([needFilterStr length]>0&&![needFilterStr isEqualToString:@"(null)"]) {
//                NSArray *arrNeedFilters = [needFilterStr componentsSeparatedByString:@","];
//                
//                
//                //*** needFilter take out with ":" to divOut
//                NSArray *arr;
//                
//                //*** many needFilters in one string take out the string we wang to use with "valueP"
//                for (NSString *needFilterTakeOut in arrNeedFilters) {
//                    if ([needFilterTakeOut hasPrefix:@"valuePlug_"]) {
//                        
//                        NSString *selectSchoolKey = @"";
//                        NSString *selectSchoolValue = @"";
//
//                        arr = [[NSString stringWithFormat:@"%@",  needFilterTakeOut]componentsSeparatedByString:@":"];
//                      //*** save key for this ceycle
//                        if(arr.count>0)selectSchoolKey = [NSString stringWithFormat:@"%@", arr[0]];
//
//                        for (EditModel *model in _fieldArrText) { // for one
//                            
//                            NSString *fieldRoleMoment =[NSString stringWithFormat:@"%@", model.fieldRole];
//                            NSInteger numMoment =[fieldRoleMoment integerValue];
//
//                            NSString *str = [NSString stringWithFormat:@"%@", model.fieldId];
//
//
//#warning 可能会崩溃
//                            if ([str isEqualToString:arr[1]]) { // if two
//                                EditModel *dicForThis= model;
//                                NSString *fieldRole= [NSString stringWithFormat:@"%@", model.fieldRole];
//                                
//                                NSString *fieldId;
//                                if([dicForThis valueForKey:@"relationTableId"]!=nil){
//                                    fieldId= [NSString stringWithFormat:@"%@", dicForThis.dialogField];
//                                    
//                                }else{
//                                    fieldId= [NSString stringWithFormat:@"%@", dicForThis.fieldId];
//                                    
//                                }
//                                
//                                if(fieldId == nil){
//                                    fieldId = [NSString stringWithFormat:@"%@", dicForThis.fieldId];
//                                }
//
//                                NSString *pageId= [_EditDic objectForKey:@"startTurnPage"];
//                                NSString *tableId= [_EditDic objectForKey:@"tableId"];
//                                NSString *baseString = [NSString stringWithFormat:@"_au_%@_%@_%@",tableId,pageId,fieldId];
//                                
//                                
//                                NSString *baseStringSend = [NSString stringWithFormat:@"_au_%@_%@_%@",model.relationTableId,pageId,fieldId];
//
//                                //*** 前提条件下 传送前提条件
//                                if([_sendMutDic valueForKey:[KeyNameClass getKeyName:fieldRole andBaseString:baseString andTUseString:self.tString]]&&numMoment != 21){
//                                    
//                                    selectSchoolValue = [NSString stringWithFormat:@"%@", [_sendMutDic valueForKey:[KeyNameClass getKeyName:fieldRole andBaseString:baseString andTUseString:self.tString]]];
//                                }else if(_manyManyArr && numMoment == 21){
//                                    
//                                    NSMutableArray *valueArrs = [[NSMutableArray alloc]init];
//                                    
//                                    for ( NSDictionary *dicManyArr in _manyManyArr) {
//                                        
//                                        NSString *relationTableId=[NSString stringWithFormat:@"%@",model.relationTableId] ;
//                                        NSString *showFieldArr=[NSString stringWithFormat:@"%@",model.showFieldArr] ;
//                                        NSString *dialogField=[NSString stringWithFormat:@"%@",model.dialogField] ;
//                                        
//                                        NSString *fieldOfValue =[NSString stringWithFormat:@"t%i_au_%@_%@_%@",_tNum+1 ,relationTableId,showFieldArr,dialogField];
//
//                                        
//                                        if([dicManyArr valueForKey:fieldOfValue]){
//                                            [valueArrs addObject:[dicManyArr valueForKey:fieldOfValue]];
//                                        }
//                                    }
//                                    
//                                    selectSchoolValue = [NSString stringWithFormat:@"%@", [valueArrs componentsJoinedByString:@","]];
//                                    
//                                    if([_sendMutDic valueForKey:[KeyNameClass getKeyName:fieldRole andBaseString:baseStringSend andTUseString:self.tString]]&&selectSchoolValue.length<=0){
//                                        selectSchoolValue = [_sendMutDic valueForKey:[KeyNameClass getKeyName:fieldRole andBaseString:baseStringSend andTUseString:self.tString]];
//                                    }
//                                }else{
//                                    selectSchoolValue = @"";
//                                }
//                                
//                            }    // if two end
//                        }
//                        
//                        if(selectSchoolKey.length>0)[selectSchoolKeyValueDic setObject:selectSchoolValue forKey:selectSchoolKey];
//
//                    }else{
//                        
//                    }
//                  
//                }
//               
//            }
//            
//            SelectSchoolController *sv =[[SelectSchoolController alloc]init];
//            sv.delegateView = self;
//            
//            if(num == 20||num == 22){ // 但只选择项
//                sv.one = YES;
//            }else{
//                sv.one = NO;
//            }
////            if([[NSString stringWithFormat:@"%@", [dic valueForKey:@"chooseType"]] isEqualToString:@"1"]){
//                if([[NSString stringWithFormat:@"%@", model.chooseType] isEqualToString:@"1"]){
//
//                sv.treeDir = YES;
//            }else{
//                sv.treeDir = NO;
//            }
//            
//            //*** premiseDic
//            sv.premiseDic = selectSchoolKeyValueDic;
//
//            
//            NSDictionary *d = model.dialogDataList;
//
//            sv.schoolArr = [d objectForKey:@"rows"];
//            
//            NSString *requestUrl = [NSString stringWithFormat:@"%@%@", self.programaUrl, LISTSVIEWREQUEST_URL];
//            
////            sv.searchArr = [dic objectForKey:@"dialogSearchSet"];
//            
//            sv.searchArr = model.dialogSearchSet;
//
////            NSString *pageId= [dic objectForKey:@"pageDialog"];
//            
//            NSString *pageId= model.pageDialog;
//
//            NSString *tableId;//= [dic objectForKey:@"tableId"];
//            
//            if(model.tableId){
//                tableId = model.tableId;
//                sv.schoolFieldStr = [NSString stringWithFormat:@"%@", model.tableId];
//
//            }else{
//                tableId = model.relationTableId;
//                sv.schoolFieldStr = [NSString stringWithFormat:@"%@", model.relationTableId];
//
//            }
//            sv.pageId = pageId;
//            
//            sv.tableId = tableId;
//            
//            sv.searchUrl = requestUrl;
//            
//            sv.rowNum = indexPath.row;
//            _rowsNum = indexPath.row;
//            
//            [self.navigationController pushViewController:sv animated:YES];
//
//        }
//        
//    }
//    else if (roleNum==17){//多选
//        [self.view bringSubviewToFront:_backImg];
//        _backImg.hidden = NO;
//        [self.view bringSubviewToFront:_SelectManyView];
//        [UIView animateWithDuration:0.5 animations:^{
//
//            _SelectManyView.frame = CGRectMake(50, 100, [UIScreen mainScreen].bounds.size.width-100, 200);
//        }];
//        _indexNum = indexPath.row;
//        NSString *dicstr = model.dicOptions;
//        NSData *dicData = [dicstr dataUsingEncoding:NSUTF8StringEncoding];
//        NSArray *dicArr = [NSJSONSerialization JSONObjectWithData:dicData options:0 error:nil];
////        _pickerView.hidden = YES;
//        _pickerTime.hidden = YES;
//        _SelectManyView.dataArr = dicArr;
//        _SelectManyView.hidden = NO;
//        
////        if () {
////            <#statements#>
////        }
//    }else if(roleNum == 15){
//        
//        self.pickerTime.dataFormate = model.dateType;
//        self.pickerTime.hidden = NO;
//        self.pickerTime.datePicer.datePickerMode = UIDatePickerModeTime;
//
//    }
//    else if (roleNum == 14||roleNum==28||roleNum==26){ // 14年月日时分秒 ||roleNum == 15
//        self.pickerTime.dataFormate = model.dateType;
//        self.pickerTime.hidden = NO;
//        self.pickerTime.datePicer.datePickerMode = UIDatePickerModeDate;
//        
////        [self createPickerView];
//    }
//    else {
//        
//        EditCell *cell = (EditCell *)[tableView cellForRowAtIndexPath:indexPath];
//        
//        CustomLabel *textField = cell.titleText;
//        [self.navigationController pushViewController:sv animated:YES];
//        NSString *str= [NSString stringWithFormat:@"%@",textField.text];
//        sv.oneFieldDic = model;
//        sv.oneName =_detailDic;
//        sv.rowsNum = _rowsNum;
//        sv.dataStr = str;
//        sv.delegate = self;
//    }
}


//#pragma mark pickerViewDelegate
////返回组数
//- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerVie{
//    return 6;
//}
////返回行数
//-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
//{
//    NSLog(@"%li", (long)component);
//    if(yeaArr.count<3)return 0;
//    //    return ((NSArray *)yeaArr[component]).count;
//    if(component == 0){
//        return yeaArr.count;
//    }else if(component == 1){
//        return 1;
//        
//    }else if (component == 2){
//        return 12;
//    }else if (component == 3){
//        return 1;
//    } else if(component == 4){
//        //        NSLog(@"%@", yeaArr);
//        NSInteger row1=[_pickerView selectedRowInComponent:0];
//        NSInteger row2=[_pickerView selectedRowInComponent:2];
//        //然后是获取这个行中的值，就是数组中的值
//        //        int a = [label.text intValue];
//        
//        //        int b = [label1.text intValue];
//        
//        NSDictionary *dic = yeaArr[row1];
//        NSArray *arr2 = [dic allKeys];
//        NSArray *arr = [dic valueForKey:arr2[0]];
//        NSArray *arr1 = arr[row2];
//        //        NSLog(@"%@", arr);
//        //        NSLog(@"%@", arr1);
//        return arr1.count;
//    }else{
//        return 1;
//    }
//}
//-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
//{
//    
//    return @"2015";
//}
//选中row
//- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
//    UILabel *label = (UILabel *)[pickerView viewForRow:row forComponent:component];
//    NSLog(@"%@", label.text);
//    [self textData:label.text andCompoment:component];
//    if (component == 2) {
//        [_pickerView reloadComponent:4];
//    }
//    NSLog(@"row:%ld",(long)row);
//}
//
//-(void)textData:(NSString *)text andCompoment:(NSInteger)compoment{
//    NSLog(@"%@", text);
//    if (compoment == 0) {
//        yeaStr = text;
//    }else if(compoment == 2){
//        montStr = text;
//    }else if (compoment == 4){
//        daStr = text;
//    }
//    [self testString];
//}
//
//-(void)testString{
//    if (yeaStr&&montStr&&daStr) {
//        NSLog(@"%@", [NSString stringWithFormat:@"%@-%@-%@", yeaStr, montStr, daStr ]);
//    }
//}
////设置选取器的字体
//- (UILabel *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
//    UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(50, 10, 150, 50)];
//    if(component == 0){
//        if(row == 0){
//            NSArray *arr = [(NSDictionary *)(yeaArr[component]) allKeys];
//            label.text=arr[0];
//        }else if(row == 1){
//            NSArray *arr = [(NSDictionary *)(yeaArr[1]) allKeys];
//            label.text=arr[0];
//        }else if(row == 2){
//            NSArray *arr = [(NSDictionary *)(yeaArr[2]) allKeys];
//            label.text=arr[0];
//        }
//    }else if (component == 1){
//        label.text = @"年";
//    } else if(component == 2){
//        //        NSArray *arr = [(NSDictionary *)(yeaArr[component]) allKeys];
//        label.text=[NSString stringWithFormat:@"%i", (int)row+1];
//        
//    }else if (component == 3){
//        label.text = @"月";
//    } else if(component == 4){
//        //        NSLog(@"%@", yeaArr);
//        NSInteger row1=[_pickerView selectedRowInComponent:0];
//        NSInteger row2=[_pickerView selectedRowInComponent:1];
//        //然后是获取这个行中的值，就是数组中的值
//        
//        NSDictionary *dic = yeaArr[row1];
//        NSArray      *arr2 = [dic allKeys];
//        NSArray *arr = [dic valueForKey:arr2[0]];
//        NSArray *arr1 = arr[row2];
//        NSLog(@"%@", arr);
//        NSLog(@"%@", arr1);
//        label.text = arr1[row];
//        
//    }else if (component == 5){
//        label.text = @"日";
//    }
//    
//    label.textAlignment=NSTextAlignmentCenter;
//    label.font=[UIFont systemFontOfSize:25];
//    return label;
//}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



-(void)editRequest{
    NSLog(@"%@",_schoolsArr);
    
//    [self setHiddens];
    [keyValueClass setHiddens:_hiddenArr andSendDic:_sendMutDic andMana:_manyManyArr andReturnBlock:^(NSMutableDictionary *send, NSMutableArray *manyman) {
        _sendMutDic = send;
        _manyManyArr = manyman;
    }];
    if([_isSeleItem isEqualToString:@"yes"]){
        
    }
    else{
        [_manyManyArr addObjectsFromArray:_schoolsArr];
    }
    [_sendMutDic setObject:userName() forKey:@"loginName"];
    [_sendMutDic setObject:passWord() forKey:@"password"];
    
    [_sendMutDic setObject:[_fieldDic objectForKey:@"startTurnPage"] forKey:@"pageId"];

    NSString *t_str = [NSString stringWithFormat:@"T_%@_0",self.tableId];
    if (getSessionId()) {
        [_sendMutDic setObject: getSessionId() forKey:@"sessionId"];
    }

    [_sendMutDic setObject:self.tableId forKey:@"tableId"];

    NSString *baseString = [NSString stringWithFormat:@"_au_%@_%@",[_EditDic objectForKey:@"tableId"],[_EditDic objectForKey:@"startTurnPage"]];
    
    [_sendMutDic setObject:[_detailDic objectForKey:t_str] forKey:[KeyNameClass getKeyName:@"1" andBaseString:baseString andTUseString:self.tString]];
    
    [_sendMutDic setObject: @"1" forKey:@"source"];
    
    NSArray *keyArray = [_sendMutDic allKeys];
    for(int i=0;i<keyArray.count;i++){
        NSMutableDictionary *ddd = [[NSMutableDictionary alloc]init];
        [ddd setValue:[_sendMutDic objectForKey:keyArray[i]] forKey:keyArray[i]];
        [_manyManyArr addObject:ddd];
        
    }


    NSString *urlfieldAtr = [keyValueClass fieldDicToString:_manyManyArr isAdd:NO]; //[self fieldDicToString:_manyManyArr];
    
    NSString *lastUrl = [NSString stringWithFormat:@"%@%@", self.programaUrl, UPDATEMFSUB_URL];
    
    
    

    //*** hidden the netWork state activity
    
    
    NSString *lastUrl12 = [NSString stringWithFormat:@"%@?%@", lastUrl, urlfieldAtr];//[NSString stringWithFormat:@"%@?%@",requestStr,urlfieldAtr];
    
    if([lastUrl12 hasPrefix:@"http://182.92.74.232:9994"]){
        NSArray *arr = [lastUrl12 componentsSeparatedByString:@"182.92.74.232:9994"];
        lastUrl12 = [NSMutableString stringWithFormat:@"%@%@%@", arr[0], @"182.92.108.162:8124", arr[1]];
    }

    NSString * urlString= [lastUrl12 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url_str=[NSURL URLWithString:urlString];
    
    
http://192.168.6.150:8081/edus_auto/update_interfaceUpdate.do?t1_au_20_1372_184=&t0_au_20_1372_183_dz=1&t1_au_24_1378_233=&t0_au_24_1378_232_dz=1&tableId=19&t0_au_19_1232=365&loginName=admin&pageId=1232&t0_au_19_1232_574=&t0_au_19_1232_180=6&source=1&t0_au_19_1232_1880=&password=000000&t0_au_19_1232_179=9&t0_au_19_1232_1882=&t0_au_19_1232_172=13455554444&t0_au_19_1232_721=&t0_au_19_1232_452=&t0_au_19_1232_171=Tianjin



    NSLog(@"%@", lastUrl);
   
   
    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url_str];
    //    3.发送请求
    //发送异步请求，在主线程执行
    NSOperationQueue *queue=[NSOperationQueue mainQueue];
    
    [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse * _Nullable response, NSData * _Nullable data, NSError * _Nullable connectionError) {
        if(data!=nil&&!connectionError){
            
                NSString *dataStr=  [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
            
            
            
#pragma mark - 登录超时返回登录页
            NSRange range = [dataStr rangeOfString:@"登录超时"];
            
            if (range.location != NSNotFound) {
                [self sessionIsOverTime:dataStr];
                return;
            }
#pragma mark - 登录超时end
            
                //            NSDictionary *obj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
                if([dataStr isEqualToString:@"1"]){
                    
                    //*** post the notifacation center should reload list view controller
                    [[NSNotificationCenter defaultCenter]postNotificationName:@"shouldReload" object:@"ok"];
                    
                    _alert =[[UIAlertView alloc]initWithTitle:nil message:@"修改成功" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
                    [_alert show];
                    
                    editSucceed = YES;
                    
                    [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(performDismiss:) userInfo:nil repeats:NO];
                    [[NSNotificationCenter defaultCenter]postNotificationName:@"changeSuccess" object:@"1"];
                    
                }
                
                else{
                    _alert =[[UIAlertView alloc]initWithTitle:nil message:@"修改失败" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
                    [_alert show];
                    
                    editSucceed = NO;
                    
                    [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(performDismiss:) userInfo:nil repeats:NO];
                    
                    
                    //        NSTimer *time =[NSTimer scheduledTimerWithTimeInterval:0.4 target:self selector:@selector(doTime) userInfo:nil repeats:NO];
                    [_sendMutDic removeAllObjects];
                }
                
                //*** hidden the netWork state activity
                [[UIApplication sharedApplication]setNetworkActivityIndicatorVisible:NO];
                
                
        }else{
                NSString *str = [NSString stringWithFormat:@"%@", connectionError.localizedDescription];
                [self showLabelWithText:str];
                //*** hidden the netWork state activity
                [[UIApplication sharedApplication]setNetworkActivityIndicatorVisible:NO];
                
            }

        
    }];
    
    
}



#pragma mark - 修改成功后计时自动返回
-(void) performDismiss:(NSTimer *)timer
{
    [_alert dismissWithClickedButtonIndex:0 animated:NO];
    if(editSucceed){
        if (self.retureView) {
            NSArray *arr = self.navigationController.viewControllers;
            
            for (id  viewController in arr) {
                if ([viewController isKindOfClass:[self.retureView class]]) {
                    [self.navigationController popToViewController:viewController animated:YES];
                    return;
                    
                }
            }
        }else{
            [self.navigationController popViewControllerAnimated:YES];
        }
    }
}

#pragma mark - UIAlertViewDele
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSLog(@"%ld",(long)buttonIndex);
    
    if (alertView == _alertSure1) {
        if(buttonIndex==1){
            [self editRequest];
        }
        else{
            _alertSure1.hidden = YES;
        }
        
        self.editBtn.enabled = YES;
        return;
    }
    NSLog(@"%ld",(long)buttonIndex);
    if(buttonIndex==0&&alertView==_alert){
        if (self.retureView) {
            NSArray *arr = self.navigationController.viewControllers;
            
            for (id  viewController in arr) {
                if ([viewController isKindOfClass:[self.retureView class]]) {
                    [self.navigationController popToViewController:viewController animated:YES];
                    return;
                    
                }
            }
        }else{
            [self.navigationController popViewControllerAnimated:YES];
        }
    }
    else if(alertView==_alert){
        _alert.hidden = YES;
    }
    
    if(buttonIndex==1){
        [self.navigationController popViewControllerAnimated:YES];
    }
    else{
        _alert.hidden = YES;
    }
    
}



-(void)dealloc{
    self.tbView.delegate = nil;
    self.tbView.dataSource = nil;
//    _pickerView.delegate = nil;
//    _pickerView.dataSource = nil;
    
}


//-(NSString *)makeTheBaseString:(EditModel *)model{
//    
//    NSString *fieldRole= model.fieldRole;
////    NSString *fieldId= [dic objectForKey:@"fieldId"];
//    NSString *pageId= [_EditDic objectForKey:@"startTurnPage"];
//    
//    
//    NSString *fieldId;
//    if(model.relationTableId!=nil){
//        if(model.dialogField){
//            
//            fieldId= model.dialogField;
//        }else{
//            fieldId= model.fieldId;
//        }
//    }else{
//        fieldId= model.fieldId;
//        
//    }
//    //*** change the tableId
//    NSString *tableId= [_EditDic objectForKey:@"tableId"];
//    NSString *baseString = [NSString stringWithFormat:@"_au_%@_%@_%@",tableId,pageId,fieldId];
//    
//    return baseString;
//}

//-(void)setHiddens{
//    for (EditModel *model in _hiddenArr) {
//        NSString *fieldRole = [NSString stringWithFormat:@"%@", model.fieldRole]; //[dic objectForKey:@"fieldRole"];
//        NSInteger addStyle = [[NSString stringWithFormat:@"%@", model.addStyle] integerValue];
//        
//        NSInteger num =[fieldRole integerValue];
//        if (num == 16) {
//            [self setHiddenDataDic:model];
//        }
//    }
//}

//#pragma mark - setHiddenDataDic 隐藏字段区
//-(void)setHiddenDataDic:(EditModel *)model{
//    
//    NSString *dicDefaultSelectStr = [NSString stringWithFormat:@"%@", model.dicDefaultSelect];     NSString *fieldRole= [NSString stringWithFormat:@"%@", model.fieldRole]; //[dic objectForKey:@"fieldRole"];
////    NSString *fieldId= [NSString stringWithFormat:@"%@", model.fieldId]; //[dic objectForKey:@"fieldId"];
////    NSString *pageId= [_ADDBTN objectForKey:@"startTurnPage"];
//    
//#warning ttableId may not this
////    NSString *tableId= [_ADDBTN objectForKey:@"tableId"];
//    NSString *baseString = model.montageName;
//    [_sendMutDic setObject:dicDefaultSelectStr forKey:baseString];
//    
//    //*** receive show
//    
//    NSLog(@"%@",_sendMutDic);
//    
//    
//}

//#pragma mark - 前提条件设完修改前提条件
//-(void)removeAlready:(EditModel *)model{
//    NSString *fieldRole =[NSString stringWithFormat:@"%@", model.fieldRole]; //[dic objectForKey:@"fieldRole"];
//    NSInteger num =[fieldRole integerValue];
////    NSString *indexPath = [dic valueForKey:@"indexPath"];
////    NSString *selectKeyString = [NSString stringWithFormat:@"%@", indexPath];
//
//    if(num == 16){
////        NSString *keyString = [self dataDicKeyGet:model orDefaultId:nil];
//        if ([_sendMutDic valueForKey:model.montageName]) {
//            [_sendMutDic removeObjectForKey:model.montageName];
//
//            model.true_defaultShowValName = @"";
////            if([_textDic valueForKey:selectKeyString]){
////
////                [_textDic removeObjectForKey:[NSString stringWithFormat:@"%@", indexPath]];//删除默认显示值
////            }
//
//        }
//
//    }else if (num == 17){//多选
//    }else if(num == 20||num == 21||num == 22){ //*** 下拉树  + 弹层
//        if(num == 22||num == 20){
//            NSString *strK = [self getAlertKKey:model];
//            [_sendMutDic removeObjectForKey:strK];
//
//            model.true_defaultShowValName = @"";
//
////            if([_textDic valueForKey:selectKeyString]){
////
////                [_textDic removeObjectForKey:[NSString stringWithFormat:@"%@", indexPath]];//删除默认显示值
////            }
//        }
//        else if(num == 21){
//            NSString *field = [self getAlertMoreKKeyFieldOfValue:model];
//            NSString *fieldN = [self getAlertMoreKKeyFieldOfNum:model];
//            [_manyManyArr enumerateObjectsUsingBlock:^(NSDictionary * obj, NSUInteger idx, BOOL * _Nonnull stop) {
//                if ([obj valueForKey:field]) {
//
////                    if([_textDic valueForKey:[NSString stringWithFormat:@"%@", indexPath]])[_textDic removeObjectForKey:[NSString stringWithFormat:@"%@", indexPath]];//删除默认显示值
//                    model.true_defaultShowValName = @"";
//
//                    [_manyManyArr removeObject:obj];
//                }else if([obj valueForKey:fieldN]){
//                    [_manyManyArr removeObject:obj];
//                }
//            }];
//        }
//    }else{
////        NSString *normalKey = [self getNorMalKey:dic];
//        if ([_sendMutDic valueForKey:model.montageName]) {
//            [_sendMutDic removeObjectForKey:model.montageName];
//
//            model.true_defaultShowValName = @"";
////            if([_textDic valueForKey:selectKeyString]){
////
////                [_textDic removeObjectForKey:[NSString stringWithFormat:@"%@", indexPath]];//删除默认显示值
////            }
//
//        }
//    }
//
//    [self.tbView reloadData];
//}

//#pragma mark - 平常字段键获取
//-(NSString *)getNorMalKey:(NSDictionary *)dic{
//
//    NSString *fieldRole= [dic objectForKey:@"fieldRole"];
//    NSString *fieldId= [dic objectForKey:@"fieldId"];
//    NSString *pageId= [_EditDic objectForKey:@"startTurnPage"];
//    //*** change the tableId
//    NSString *tableId= [_EditDic objectForKey:@"tableId"];
//    NSString *baseString = [NSString stringWithFormat:@"_au_%@_%@_%@",tableId,pageId,fieldId];
//
//    NSString *returnKey = [KeyNameClass getKeyName:fieldRole andBaseString:baseString andTUseString:self.tString];
//    return returnKey;
//}

//#pragma mark - 多选下弹层键fieldOfValue
//-(NSString *)getAlertMoreKKeyFieldOfValue:(EditModel *)model{
//
//    NSString *fieldId;
//
//    if(model.relationTableId!=nil){
//        if(model.dialogField){
//
//            fieldId= [NSString stringWithFormat:@"%@", model.dialogField];
//        }else{
//            fieldId= [NSString stringWithFormat:@"%@", model.fieldId];
//        }
//    }else{
//        fieldId= [NSString stringWithFormat:@"%@", model.fieldId];
//    }
//
//    NSString *showFieldArr=[NSString stringWithFormat:@"%@",model.showFieldArr] ;
//    NSString *relationTableId=[NSString stringWithFormat:@"%@",model.relationTableId] ;
//
//    NSString *fieldOfValue =[NSString stringWithFormat:@"t%i_au_%@_%@_%@", _tNum+1,relationTableId,showFieldArr,fieldId];
//    return fieldOfValue;
//}

//#pragma mark - 多选下弹层fieldOfNum
//-(NSString *)getAlertMoreKKeyFieldOfNum:(EditModel *)model{
//
//    NSString *usageFieldId = model.fieldId;
//
//    NSString *relationTableId=[NSString stringWithFormat:@"%@",model.relationTableId] ;
//    NSString *showFieldArr=[NSString stringWithFormat:@"%@",model.showFieldArr] ;
//    NSString *fieldId;
//    if(model.relationTableId!=nil){
//        if(model.dialogField){
//
//            fieldId= model.dialogField;
//        }else{
//            fieldId= model.fieldId;
//        }
//    }else{
//        fieldId= model.fieldId;
//
//    }
//
//    NSString *fieldOfNum;
//    if(usageFieldId){
//
//        fieldOfNum=[NSString stringWithFormat:@"%@_au_%@_%@_%@_dz", _tString,relationTableId,showFieldArr,usageFieldId];
//    }else{
//        fieldOfNum=[NSString stringWithFormat:@"%@_au_%@_%@_%@_dz", _tString,relationTableId,showFieldArr,fieldId];
//    }
//
//    return fieldOfNum;
//}

//#pragma mark - 弹出层键拼接
//-(NSString *)getAlertKKey:(EditModel *)model{
//
//    NSString *fieldRole= model.fieldRole;
//
//    NSString *fieldId;
//    if ([[NSString stringWithFormat:@"%@", model.fieldId]isEqualToString:@"630"]) {
//
//    }
//
//#warning maybe difernt tableId to use it for a moment
//
//    NSString *baseString = [self makeTheBaseString:model];
//
//
////    NSString *fieldOfNum;
//
//    NSString *keyString = [KeyNameClass getKeyName:fieldRole andBaseString:baseString andTUseString:self.tString];
//
//    return keyString;
//}

//#pragma mark - 前提条件提取
//-(BOOL)textQianTiTiaoJian:(EditModel *)model{
////    NSString *jsWhereStr = [NSString stringWithFormat:@"%@", [dic valueForKey:@"jsWhereStr"]]; //前提条件字符串
//    NSString *jsWhereStr = [NSString stringWithFormat:@"%@", model.jsWhereStr]; //前提条件字符串
//
//    NSArray *arrDev = [jsWhereStr componentsSeparatedByString:@" == "];                        //前提条件分割键值
//
//    NSMutableString *arrDevSMut;
//    if(arrDev[0])arrDevSMut= [NSMutableString stringWithFormat:@"%@", arrDev[0]];              //防止空字符串
//    NSRange range1 = [arrDevSMut rangeOfString:@"#{"]; //将无用的#{去掉
//    if (range1.location != NSNotFound) {
//        [arrDevSMut replaceCharactersInRange:range1 withString:@""];
//    }
//
//    NSRange range2 = [arrDevSMut rangeOfString:@"}"]; //将无用的}去掉
//    if (range2.location != NSNotFound) {
//        [arrDevSMut replaceCharactersInRange:range2 withString:@""];
//    }
//
//    NSArray *arrDevId = [arrDevSMut componentsSeparatedByString:@":"]; // 分离默认Id
//    NSString *fieldIdQt;
//    if(arrDevId.count>1)fieldIdQt = [NSString stringWithFormat:@"%@", arrDevId[1]];
//    if (fieldIdQt) {
//        NSString *settedKeyString = [self dataDicKeyGet:nil orDefaultId:fieldIdQt];//看是否有设置
//        NSString *settedValueString = [_sendMutDic valueForKey:settedKeyString];//无返回
//        if (![settedValueString isEqualToString:arrDev[1]]) {
//            return NO;//不是需要的前提条件
//        }else{
//            return YES;//是需要的前提条件
//        }
//    }
//    return YES;//默认返回YES
//
//}

//#pragma mark - 数据字典拼接获取
//-(NSString *)dataDicKeyGet:(EditModel *)model orDefaultId:(NSString *)fieldId{
//
//    if(fieldId){
//
//    }else{
//
//        fieldId= [NSString stringWithFormat:@"%@", model.fieldId]; //[dic objectForKey:@"fieldId"];
//    }
//    NSString *pageId= [_EditDic objectForKey:@"startTurnPage"];
//    NSString *tableId= [_EditDic objectForKey:@"tableId"];
//
//    NSString *fieldRole= [NSString stringWithFormat:@"%@", @"16"];//[dic objectForKey:@"fieldRole"];
//    NSString *baseString = [NSString stringWithFormat:@"_au_%@_%@_%@",tableId,pageId,fieldId];
//
//    NSString *returnStr = [KeyNameClass getKeyName:fieldRole andBaseString:baseString andTUseString:self.tString];
//    return returnStr;
//}


//#pragma mark - 对象的内部 回调 ， 默认设置值 bing保证上传时有值不为空
//-(void)whileFieldRowTypeIsspeciall:(EditModel *)model{
//    NSString *fieldOfNum;
//    NSString *fieldOfValue;
//
//
//    NSString *fieldId;
//
//    if(model.relationTableId!=nil){
//        if(model.dialogField){
//
//            fieldId= [NSString stringWithFormat:@"%@", model.dialogField];
//        }else{
//            fieldId= model.fieldId;
//        }
//    }else{
//        fieldId= model.fieldId;
//
//    }
//
//    fieldOfValue = [self getAlertMoreKKeyFieldOfValue:model]; // t1
//    //    fieldOfNum = [self getAlertMoreKKeyFieldOfNum:model];   // dz
//
////    fieldOfNum = [NSString stringWithFormat:@"%@", model.montageName];   // dz
//        fieldOfNum = [self getAlertMoreKKeyFieldOfNum:model];   // dz  // 还是有点问题等待陈蒙回来解决
//
//    NSString *fieldRole =[NSString stringWithFormat:@"%@", model.fieldRole];
//    NSInteger num =[fieldRole integerValue];
//    if(num == 22||num == 20){
////        NSString *pageId= [_EditDic objectForKey:@"startTurnPage"];
////        //            NSString *tableId= [_dataDic objectForKey:@"tableId"];
////
////        NSString *tableId= [_EditDic objectForKey:@"tableId"];
////
////        NSString *baseString = [NSString stringWithFormat:@"_au_%@_%@_%@",tableId,pageId,fieldId];
////
////        NSString *str;
////        if(model.true_defaultShowValName){
////
////            str= model.true_defaultShowValName;
////        }else{
////        str = @"";
////        }
////        [_sendMutDic setObject:[NSString stringWithFormat:@"%@", str] forKey:[KeyNameClass getKeyName:fieldRole andBaseString:baseString andTUseString:self.tString]];
//
//
//        //        [_sendMutDic setObject:[NSString stringWithFormat:@"%@", str] forKey:model.montageName];
//
//        //        [_sendMutDic setObject:[NSString stringWithFormat:@"%@", str] forKey:[self getAlertKKey:model]];
//
//
//                NSString *pageId= [_EditDic objectForKey:@"startTurnPage"];
//                //            NSString *tableId= [_dataDic objectForKey:@"tableId"];
//
//                NSString *tableId= [_EditDic objectForKey:@"tableId"];
//
//                NSString *baseString = [NSString stringWithFormat:@"_au_%@_%@_%@",tableId,pageId,fieldId];
//
//        NSString *str;
//        if(model.true_defaultShowValId){
//
//            str=model.true_defaultShowValId;
//        }else{
//            str = @"";
//        }
//                [_sendMutDic setObject:[NSString stringWithFormat:@"%@", str] forKey:[KeyNameClass getKeyName:fieldRole andBaseString:baseString andTUseString:self.tString]];
//
//
//        //        [_sendMutDic setObject:[NSString stringWithFormat:@"%@", str] forKey:model.montageName];
//
//        //        [_sendMutDic setObject:[NSString stringWithFormat:@"%@", str] forKey:[self getAlertKKey:model]];
//
//    }else if(num == 21){
//        if(_manyManyArr.count!=0){
//            NSMutableArray *muArr = [[NSMutableArray alloc]initWithArray:_manyManyArr];
//
//            for(NSDictionary *dict in _manyManyArr){
//                if([[dict allKeys] containsObject:fieldOfValue]||[[dict allKeys] containsObject:fieldOfNum]){
//                    [muArr removeObject:dict];
//                }
//            }
//            _manyManyArr = muArr;
//        }
//        NSArray *arr;
//        if(model.true_defaultShowValId){
//
//            arr = [[NSString stringWithFormat:@"%@", model.true_defaultShowValId] componentsSeparatedByString:@","];
//        }
//        NSInteger arrNUm = [arr count];
//
//        for(int i=0;i<arrNUm;i++){
//            NSMutableDictionary *ddd = [[NSMutableDictionary alloc]init];
//            [ddd setObject:[arr objectAtIndex:i] forKey:fieldOfValue];
//            [_manyManyArr addObject:ddd];
//        }
//        NSMutableDictionary *dad = [[NSMutableDictionary alloc]init];
//        [dad setObject:[NSString stringWithFormat:@"%ld",(long)arrNUm] forKey:fieldOfNum];
//        [_manyManyArr addObject:dad];
//
//    }
//    NSLog(@"%@",_sendMutDic);
//    _isSeleItem = @"yes";
//
//}

//#pragma mark - dic  to NSString
//-(NSString *)fieldDicToString:(NSArray *)arr{
//    NSString *str = @"";
//    NSMutableArray *array = [[NSMutableArray alloc]init];
//    for(NSDictionary *dic in arr){
//        NSArray *a1 =[dic allKeys];
//        NSString *value =[dic objectForKey:a1[0]];
//        NSString *equal = [NSString stringWithFormat:@"%@=%@",a1[0],value];
//        [array addObject:equal];
//    }
//    str =[array componentsJoinedByString:@"&"];
//    return str;
//}



//#pragma time data
//-(void)currDate{
//    NSDate *now = [NSDate date];
//    NSLog(@"now date is: %@", now);
//
//    NSCalendar *calendar = [NSCalendar currentCalendar];
//    NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
//    NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:now];
//
//    int year = (int)[dateComponent year];
//    int month = (int)[dateComponent month];
//    int day = (int)[dateComponent day];
//    int hour = (int)[dateComponent hour];
//    int minute = (int)[dateComponent minute];
//    int second = (int)[dateComponent second];
//
//    yeaStr = [NSString stringWithFormat:@"%i", year];
//    montStr = [NSString stringWithFormat:@"%i", month];
//    daStr = [NSString stringWithFormat:@"%i", day];
//
//    NSLog(@"year is: %d", year);
//    NSLog(@"month is: %d", month);
//    NSLog(@"day is: %d", day);
//    NSLog(@"hour is: %d", hour);
//    NSLog(@"minute is: %d", minute);
//    NSLog(@"second is: %d", second);
//    [self pingRun:year-1 Ok:NO];
//    [self pingRun:year Ok:NO];
//    [self pingRun:year+1 Ok:YES];
//    [_pickerView selectRow:1 inComponent:0 animated:YES];
//    [_pickerView selectRow:month-1 inComponent:2 animated:YES];
//    [_pickerView selectRow:day-1 inComponent:4 animated:YES];
//
//
//}
//-(void)pingRun:(int)yea Ok:(BOOL)ok{
//    if(((yea%4==0)&&(yea%100!=0))||(yea%400==0)){
//        NSLog(@"闰年");
//        NSString *cityPath=[[NSBundle mainBundle] pathForResource:@"RunYear" ofType:@"plist"];
//        monArr=[NSArray arrayWithContentsOfFile:cityPath];
//    }
//    else
//    {
//        NSLog(@"平年");
//        NSString *cityPath=[[NSBundle mainBundle] pathForResource:@"PingYear" ofType:@"plist"];
//        monArr=[NSArray arrayWithContentsOfFile:cityPath];
//    }
//    NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
//    [dic setObject:monArr forKey:[NSString stringWithFormat:@"%i", yea]];
//    [yeaArr addObject:dic];
//    if (ok) {
//        [_pickerView reloadAllComponents];
//
//    }
//
//
//}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
